package org.xawl.news.servlet.index;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.xawl.news.entity.role.Role;
import org.xawl.news.entity.user.User;
import org.xawl.news.servlet.base.BaseServlet;
import org.xawl.news.util.SessionUtil;

public class IndexServlet extends BaseServlet {
	
	private static final long serialVersionUID = 1L;

	protected String index(HttpServletRequest request, HttpServletResponse response) {
		User currentUser = SessionUtil.getCurrentUser(request);
		Role currentRole = SessionUtil.getCurrentRole(request);
		request.setAttribute("username", currentUser.getUsername());
		request.setAttribute("rolename", currentRole.getName());
		return "forward:system/index/index";
	}
	
	protected String welcome(HttpServletRequest request, HttpServletResponse response) {
		return "forward:system/index/welcome";
	}
}
